package com.hksj.cbm.controller;

import com.hksj.cbm.dto.SpecialityModelDTO;
import com.hksj.cbm.entity.DeviceModel;
import com.hksj.cbm.entity.SpecialityModel;
import com.hksj.cbm.service.SpecialityModelService;
import com.hksj.cbm.vo.DeviceModelVO;
import com.hksj.cbm.vo.SpaceModelVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zengke
 * @version 1.0
 * @see SpecialityModelController
 * @since 2024/7/11 14:57
 */
@Api(tags = "基础模块-专业模型管理")
@RestController
@RequestMapping("/api/specialityModelDTO")
public class SpecialityModelController {

    @Autowired
    private SpecialityModelService specialityModelService;

    @ApiOperation(value = "创建专业模型")
    @PostMapping("/createSpecialityModel")
    public Rest<String> createSpecialityModel(@RequestBody SpecialityModelDTO specialityModelDTO){
        String result = specialityModelService.createSpecialityModel(specialityModelDTO);
        return Rest.ok(result);
    }

    @ApiOperation(value = "更新专业模型")
    @PutMapping("/updateSpecialityModel")
    public Rest<String> updateSpecialityModel(@RequestBody SpecialityModelDTO specialityModelDTO){
        String result = specialityModelService.updateSpecialityModel(specialityModelDTO);
        return Rest.ok(result);
    }

    @ApiOperation(value = "删除专业模型")
    @DeleteMapping("/deleteSpecialityModel")
    public Rest<String> deleteSpecialityModel(Long id){
        String result = specialityModelService.deleteSpecialityModel(id);
        return Rest.ok(result);
    }

    @ApiOperation(value = "查询专业模型树")
    @GetMapping("/querySpecialityModelTree")
    public Rest<List<SpecialityModel>> querySpecialityModelTree(){
        List<SpecialityModel> specialityModelList = specialityModelService.querySpecialityModelTree();
        return Rest.ok(specialityModelList);
    }

}
